package com.scy.hospitalmanager.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.scy.hospitalmanager.dao.nursedao.NurseTransitionDao;
import com.scy.hospitalmanager.pojo.Nurse;
import com.scy.hospitalmanager.pojo.NurseTransition;
import com.scy.hospitalmanager.service.NurseTransitionService;
import com.scy.hospitalmanager.until.GetPageNum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * @Description:
 * @ClassName: NurseTransitionServiceImpl
 * @Author: KuonnjiArisu
 * @Date: 2021/9/8 13:49
 * @Version: 1.0
 */
@Service
public class NurseTransitionServiceImpl implements NurseTransitionService {
    @Autowired
    NurseTransitionDao nurseTransitionDao;
    @Override
    public NurseTransition insertNurseTransition(NurseTransition nurseTransition) {
        return nurseTransitionDao.insertNurseTransition(nurseTransition);
    }

    @Override
    public PageInfo<NurseTransition> getAllNurseTransition(GetPageNum getPageNum) {
        PageHelper.startPage(getPageNum.getPageNo(),getPageNum.getPageSize());
        List<NurseTransition>nurseList=nurseTransitionDao.getAllNurseTransition();
        PageInfo<NurseTransition> pageInfo=new PageInfo<>(nurseList);
        return pageInfo;
    }

    @Override
    public Integer updateNurseTransition(NurseTransition nurseTransition) {
        return nurseTransitionDao.updateNurseTransition(nurseTransition);
    }

    @Override
    public Integer deleteNurseTransition(NurseTransition nurseTransition) {
        return nurseTransitionDao.deleteNurseTransition(nurseTransition);
    }

    @Override
    public NurseTransition getNurseTransitionByTrId(@RequestBody NurseTransition nurseTransition) {
        System.out.println(nurseTransitionDao.getNurseTransitionByTrId(nurseTransition));
        return nurseTransitionDao.getNurseTransitionByTrId(nurseTransition);
    }
}
